In [26]:
from __future__ import print_function
from path import Path
import re
import subprocess
Concatenate movies found in the current directory, and converts them in the process.
For example this dir:
test.1.wmv test.2.wmv test.3.wmv
freek.1.wmv freek.2.wmv
After running this script, you will have 2 movies 1 called test.mp4, the other freek.mp4.
In [44]:
d = Path('.')
ones = d.files('*1.wmv')
for f in ones:
base = re.sub('1.wmv$', '', f.name)
newname = './'+base+'concated.mp4'
series = [str(s) for s in d.files(base + '*.wmv')]
series.sort()
mmcat = ['./mmcat'] + series+ [newname]
rmc = ['rm', '-f'] + [s for s in series if s.endswith('wmv')]
print('working on:' + base)
print()
if subprocess.call(mmcat) == 0:
print('{} : succes'.format(newname))
subprocess.call(rmc)
else:
print('{} : failed'.format(newname))
In [ ]: